import request from '@/utils/request'

export function getNodeSelect() {
  return request({
    url: 'api/datatype/select',
    method: 'get'
  })
}

export function getDataResource({ page = 0, size = 100, sort = 'id,desc' } = {}) {
  return request({
    url: 'api/dataResource',
    method: 'get',
    // GET 请求通过 params 传递参数，会自动拼接为 ?page=0&size=10&sort=id,desc
    params: {
      page,
      size,
      sort
    }
  })
}

export function getAlldept() {
  return request({
    url: 'api/datatype/getalldept',
    method: 'get'
  })
}

export function getAddcatalog(data) {
  return request({
    url: 'api/catalogbaseinfo/addcatalog',
    method: 'post',
    data: data
  })
}

export function updateCatalog(data) {
  return request({
    url: 'api/catalogbaseinfo/updatecatalog',
    method: 'post',
    data: data
  })
}

export function getSelectcatalog(data) {
  return request({
    url: 'api/catalogbaseinfo/selectcatalog',
    method: 'post',
    data: data
  })
}

export function getQueryResourByCaselogId(catalogId) {
  return request({
    url: `api/userinfo/queryResourByCaselogId/${catalogId}`,
    method: 'get',
    catalogId
  })
}

export function getAddcatalogitem(data) {
  return request({
    url: 'api/catalogItem/addcatalogitem',
    method: 'post',
    data: data
  })
}

export function getSelectcatalogitemlist(data) {
  return request({
    url: 'api/catalogItem/selectcatalogitemlist',
    method: 'post',
    data: data
  })
}

export function getUpdatecatalogitem(data) {
  return request({
    url: 'api/catalogItem/updatecatalogitem',
    method: 'post',
    data: data
  })
}

export function getDelcatalogitem(id) {
  return request({
    url: `api/catalogItem/delcatalogitem/${id}`,
    method: 'get'
  })
}

export function getDelcatalogitemIds(data) {
  return request({
    url: `/api/catalogItem/delcatalogitems`,
    method: 'post',
    data: data
  })
}

export function getDelcatalog(id) {
  return request({
    url: `api/catalogbaseinfo/delcatalog/${id}`,
    method: 'get'
  })
}

export function addApplication(data) {
  return request({
    url: `api/catalogUpperLower/addApplication`,
    method: 'post',
    data: data
  })
}

export function addAppcreate(data) {
  return request({
    url: `/api/sharingApp/create`,
    method: 'post',
    data: data
  })
}

export function getCatalogdetail(id) {
  return request({
    url: `api/catalogbaseinfo/catalogdetail/${id}`,
    method: 'get'
  })
}

